<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./../../Template/generalTemplate.xhtml">

            <ui:define name="content">

                <h:form id="form">
                    <f:view beforePhase="#{convertManagedBean.initView}">
                        <p:panel id="convertSalesLead" header="Convert Sales Lead to Customer" style="height:495px;">
                            <p:growl id="growl" showDetail="true" />
                            <div style="margin-top:20px;margin-left:35px;margin-bottom:120px;postion:relative;float:left;width:450px;height:260px;">
                                <h:outputText value="#{convertManagedBean.title1}" style="font-weight:bold;"/>
                                <p:dataTable  id="billing" value="#{convertManagedBean.billingAddressList}" var="bl" dynamic="true" emptyMessage="No Billing Address yet" paginator="true" rows="3">
                                    <p:column >
                                        #{bl}
                                    </p:column>
                                    <p:column >
                                        <h:commandLink value =" Delete"  action="#{convertManagedBean.deleteBilling(bl)}"/>
                                    </p:column>

                                </p:dataTable>
                                
                            </div>
                            
                            <div style="postion:relative;margin-top:20px;margin-left:515px;margin-bottom:120px;padding:5px;width:450px;height:260px;">
                                <h:outputText value="#{convertManagedBean.title2}" style="font-weight:bold;"/>
                                <p:dataTable  id="shipping" value="#{convertManagedBean.shippingAddressList}" var="sl" dynamic="true" emptyMessage="No Shipping Address yet" paginator="true" rows="3">
                                    <p:column >
                                        #{sl}
                                    </p:column>
                                    <p:column >
                                        <h:commandLink value =" Delete"  action="#{convertManagedBean.deleteShipping(sl)}"/>
                                    </p:column>

                                </p:dataTable>
                                
                            </div>
                            <div style="position:absolute;top:440px;left:260px;">

                                <p:panel id="add" header="Add Address" toggleable="true" style="width:930px;">
                                    <table>

                                        <td><h:outputText value="Street Name"/></td>
                                        <td><h:inputText  value="#{convertManagedBean.address.streetName}" />    
                                        </td>
                                        <td><h:outputText value = "City"/></td>
                                        <td><h:inputText  value="#{convertManagedBean.address.city}"  /> 
                                        </td>
                                        <td><h:outputText value="Post Code"/></td>
                                        <td><h:inputText  value="#{convertManagedBean.address.postCode}" />    
                                        </td>
                                        <td><p:commandButton value="Add Billing" actionListener="#{convertManagedBean.addToBilling}" update="billing add growl" ajax="true"   /></td>
                                        <td><p:commandButton value="Add Shipping" actionListener="#{convertManagedBean.addToShipping}" update="shipping add growl" ajax="true"   /></td>
                                    </table>
                                </p:panel>
                            </div>
                            <p:commandButton value="Save"  ajax="false" update="growl" actionListener="#{convertManagedBean.saveCustomer}" style="margin-left:35px;"/>
                            <p:commandButton value="Back"  ajax="false" actionListener="#{convertManagedBean.goBack}" />
                        </p:panel>
                    </f:view>
                </h:form>

            </ui:define>

        </ui:composition>

    </body>
</html>

